<template>
  <div class="container">
    <nav-bar :title="title" />
    <div class="info">
      <div class="top">
        <img class="avator" :src="info.avatar" alt="">
        <span class="name">{{ info.userRealName }}</span>
      </div>
      <div class="detail">
        <div class="line">
          <span>邀请人数：</span>
          <span>{{ info.referenceNum || 0 }}</span>
        </div>
        <div class="line">
          <span>采购补贴：</span>
          <span>{{info.userCash !== undefined?'￥' + info.userCash : 0 }}</span>
        </div>
        <div class="line">
          <span>推荐收益：</span>
          <span>{{info.userRecommendCash !== undefined?'￥' + info.userRecommendCash : 0 }}</span>
        </div>
        <div class="line">
          <span>积分收益：</span>
          <span>{{ info.userPoint || 0 }}</span>
        </div>
        <div class="line">
          <span>注册时间：</span>
          <span>{{ info.createTime }}</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getInfoById } from '@/api/fans'
export default {
  name: 'Detail',
  data() {
    return {
      title: '粉丝详情',
      info: null,
      id: 1,
      zhi: 10
    }
  },
  computed: {

  },
  watch: {

  },
  async created() {
    console.log(this.$route)
    this.id = this.$route.params.id
    console.log(this.id)
    await this.init()
  },
  methods: {
    async init() {
      const res = await getInfoById({ userId: this.id })
      console.log(res)
      const info = res.map.infoById
      this.info = info
    }
  }
}
</script>
<style lang='scss' scoped>
.container{
    box-sizing: border-box;
    // padding: 24px;
    background-color: #f6f6f6;
    padding-bottom: 200px;
    .info{
        margin: 0 24px;
        padding:24px;
        margin-top: 30px;
        border-radius: 10px;
        background-color: #fff;
        .top{
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 20px;
            border-bottom: 1px solid #1e1e1e10;
            .avator{
                width: 80px;
                height: 80px;
                border-radius: 50%;
                margin-right: 20px
            }
        }
        .detail{
            display: flex;
            flex-direction: column;

            .line{
                height: 60px;
                line-height: 60px;
            }
        }
    }
}

</style>
